<!DOCTYPE html>
<html lang="" xml:lang="">
<head>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title>6.5 出版商 | Bookdown: 使用 R Markdown 创作书籍和技术文档</title>
  <meta name="description" content="这是一本使用 R Markdown 编写书籍的指南，包括如何生成图片和表格，以及如何在 R Markdown 中插入交叉引用、引文、HTML 组件和 Shiny 应用。本书能够导出为 HTML、PDF 和电子书（例如 EPUB）。本书的风格是可以定制的。你可以在 RStudio IDE 或其它编辑器中轻松地编辑和预览本书，并在你想要的任何地方（例如 bookdown.org）托管本书。" />
  <meta name="generator" content="bookdown 0.37 and GitBook 2.6.7" />

  <meta property="og:title" content="6.5 出版商 | Bookdown: 使用 R Markdown 创作书籍和技术文档" />
  <meta property="og:type" content="book" />
  <meta property="og:image" content="https://book.formlesslab.top/bookdown//images/cover.jpg" />
  <meta property="og:description" content="这是一本使用 R Markdown 编写书籍的指南，包括如何生成图片和表格，以及如何在 R Markdown 中插入交叉引用、引文、HTML 组件和 Shiny 应用。本书能够导出为 HTML、PDF 和电子书（例如 EPUB）。本书的风格是可以定制的。你可以在 RStudio IDE 或其它编辑器中轻松地编辑和预览本书，并在你想要的任何地方（例如 bookdown.org）托管本书。" />
  <meta name="github-repo" content="YuanchenZhu2020/bookdown-book-zh_CN" />

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="6.5 出版商 | Bookdown: 使用 R Markdown 创作书籍和技术文档" />
  
  <meta name="twitter:description" content="这是一本使用 R Markdown 编写书籍的指南，包括如何生成图片和表格，以及如何在 R Markdown 中插入交叉引用、引文、HTML 组件和 Shiny 应用。本书能够导出为 HTML、PDF 和电子书（例如 EPUB）。本书的风格是可以定制的。你可以在 RStudio IDE 或其它编辑器中轻松地编辑和预览本书，并在你想要的任何地方（例如 bookdown.org）托管本书。" />
  <meta name="twitter:image" content="https://book.formlesslab.top/bookdown//images/cover.jpg" />

<meta name="author" content="Yihui Xie" />


<meta name="date" content="2024-12-22" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  
  
<link rel="prev" href="html-发布功能.html"/>
<link rel="next" href="software-tools.html"/>
<script src="libs/jquery/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
<link href="libs/gitbook/css/style.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-clipboard.css" rel="stylesheet" />








<link href="libs/anchor-sections/anchor-sections.css" rel="stylesheet" />
<link href="libs/anchor-sections/anchor-sections-hash.css" rel="stylesheet" />
<script src="libs/anchor-sections/anchor-sections.js"></script>
<script src="libs/htmlwidgets/htmlwidgets.js"></script>
<link href="libs/datatables-css/datatables-crosstalk.css" rel="stylesheet" />
<script src="libs/datatables-binding/datatables.js"></script>
<link href="libs/dt-core/css/jquery.dataTables.min.css" rel="stylesheet" />
<link href="libs/dt-core/css/jquery.dataTables.extra.css" rel="stylesheet" />
<script src="libs/dt-core/js/jquery.dataTables.min.js"></script>
<link href="libs/crosstalk/css/crosstalk.min.css" rel="stylesheet" />
<script src="libs/crosstalk/js/crosstalk.min.js"></script>


<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>

<style type="text/css">
  
  div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
</style>
<style type="text/css">
/* Used with Pandoc 2.11+ new --citeproc when CSL is used */
div.csl-bib-body { }
div.csl-entry {
  clear: both;
  margin-bottom: 0em;
}
.hanging div.csl-entry {
  margin-left:2em;
  text-indent:-2em;
}
div.csl-left-margin {
  min-width:2em;
  float:left;
}
div.csl-right-inline {
  margin-left:2em;
  padding-left:1em;
}
div.csl-indent {
  margin-left: 2em;
}
</style>

<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/extra_style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="./">使用 R Markdown 创作书籍和技术文档</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>翻译与排版说明</a>
<ul>
<li class="chapter" data-level="" data-path="翻译说明.html"><a href="翻译说明.html"><i class="fa fa-check"></i>翻译说明</a></li>
<li class="chapter" data-level="" data-path="排版说明.html"><a href="排版说明.html"><i class="fa fa-check"></i>排版说明</a></li>
<li class="chapter" data-level="" data-path="翻译进度.html"><a href="翻译进度.html"><i class="fa fa-check"></i>翻译进度</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="前言.html"><a href="前言.html"><i class="fa fa-check"></i>前言</a>
<ul>
<li class="chapter" data-level="" data-path="为什么要阅读这本书.html"><a href="为什么要阅读这本书.html"><i class="fa fa-check"></i>为什么要阅读这本书</a></li>
<li class="chapter" data-level="" data-path="本书的结构.html"><a href="本书的结构.html"><i class="fa fa-check"></i>本书的结构</a></li>
<li class="chapter" data-level="" data-path="软件信息与一些约定.html"><a href="软件信息与一些约定.html"><i class="fa fa-check"></i>软件信息与一些约定</a></li>
<li class="chapter" data-level="" data-path="致谢.html"><a href="致谢.html"><i class="fa fa-check"></i>致谢</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="关于作者.html"><a href="关于作者.html"><i class="fa fa-check"></i>关于作者</a></li>
<li class="chapter" data-level="1" data-path="introduction.html"><a href="introduction.html"><i class="fa fa-check"></i><b>1</b> 简介</a>
<ul>
<li class="chapter" data-level="1.1" data-path="开发动机.html"><a href="开发动机.html"><i class="fa fa-check"></i><b>1.1</b> 开发动机</a></li>
<li class="chapter" data-level="1.2" data-path="开始.html"><a href="开始.html"><i class="fa fa-check"></i><b>1.2</b> 开始</a></li>
<li class="chapter" data-level="1.3" data-path="usage.html"><a href="usage.html"><i class="fa fa-check"></i><b>1.3</b> 使用方法</a></li>
<li class="chapter" data-level="1.4" data-path="new-session.html"><a href="new-session.html"><i class="fa fa-check"></i><b>1.4</b> 两种呈现方法</a></li>
<li class="chapter" data-level="1.5" data-path="一些提示.html"><a href="一些提示.html"><i class="fa fa-check"></i><b>1.5</b> 一些提示</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="components.html"><a href="components.html"><i class="fa fa-check"></i><b>2</b> 组成部分</a>
<ul>
<li class="chapter" data-level="2.1" data-path="markdown-syntax.html"><a href="markdown-syntax.html"><i class="fa fa-check"></i><b>2.1</b> Markdown 语法</a>
<ul>
<li class="chapter" data-level="2.1.1" data-path="markdown-syntax.html"><a href="markdown-syntax.html#内联格式"><i class="fa fa-check"></i><b>2.1.1</b> 内联格式</a></li>
<li class="chapter" data-level="2.1.2" data-path="markdown-syntax.html"><a href="markdown-syntax.html#块级元素"><i class="fa fa-check"></i><b>2.1.2</b> 块级元素</a></li>
<li class="chapter" data-level="2.1.3" data-path="markdown-syntax.html"><a href="markdown-syntax.html#数学表达式"><i class="fa fa-check"></i><b>2.1.3</b> 数学表达式</a></li>
</ul></li>
<li class="chapter" data-level="2.2" data-path="bookdown-中的-markdown-功能拓展.html"><a href="bookdown-中的-markdown-功能拓展.html"><i class="fa fa-check"></i><b>2.2</b> Bookdown 中的 Markdown 功能拓展</a>
<ul>
<li class="chapter" data-level="2.2.1" data-path="bookdown-中的-markdown-功能拓展.html"><a href="bookdown-中的-markdown-功能拓展.html#equations"><i class="fa fa-check"></i><b>2.2.1</b> 方程编号与引用</a></li>
<li class="chapter" data-level="2.2.2" data-path="bookdown-中的-markdown-功能拓展.html"><a href="bookdown-中的-markdown-功能拓展.html#theorems"><i class="fa fa-check"></i><b>2.2.2</b> 定理与证明</a></li>
<li class="chapter" data-level="2.2.3" data-path="bookdown-中的-markdown-功能拓展.html"><a href="bookdown-中的-markdown-功能拓展.html#特殊的标题"><i class="fa fa-check"></i><b>2.2.3</b> 特殊的标题</a></li>
<li class="chapter" data-level="2.2.4" data-path="bookdown-中的-markdown-功能拓展.html"><a href="bookdown-中的-markdown-功能拓展.html#text-references"><i class="fa fa-check"></i><b>2.2.4</b> 文本引用</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="r-code.html"><a href="r-code.html"><i class="fa fa-check"></i><b>2.3</b> R 代码</a></li>
<li class="chapter" data-level="2.4" data-path="figures.html"><a href="figures.html"><i class="fa fa-check"></i><b>2.4</b> 图片</a></li>
<li class="chapter" data-level="2.5" data-path="tables.html"><a href="tables.html"><i class="fa fa-check"></i><b>2.5</b> 表格</a></li>
<li class="chapter" data-level="2.6" data-path="cross-references.html"><a href="cross-references.html"><i class="fa fa-check"></i><b>2.6</b> 交叉引用</a></li>
<li class="chapter" data-level="2.7" data-path="自定义区块.html"><a href="自定义区块.html"><i class="fa fa-check"></i><b>2.7</b> 自定义区块</a></li>
<li class="chapter" data-level="2.8" data-path="citations.html"><a href="citations.html"><i class="fa fa-check"></i><b>2.8</b> 引文</a></li>
<li class="chapter" data-level="2.9" data-path="latex-index.html"><a href="latex-index.html"><i class="fa fa-check"></i><b>2.9</b> 索引</a>
<ul>
<li class="chapter" data-level="2.9.1" data-path="latex-index.html"><a href="latex-index.html#插入索引条目"><i class="fa fa-check"></i><b>2.9.1</b> 插入索引条目</a></li>
<li class="chapter" data-level="2.9.2" data-path="latex-index.html"><a href="latex-index.html#构建索引"><i class="fa fa-check"></i><b>2.9.2</b> 构建索引</a></li>
</ul></li>
<li class="chapter" data-level="2.10" data-path="html-小组件.html"><a href="html-小组件.html"><i class="fa fa-check"></i><b>2.10</b> HTML 小组件</a></li>
<li class="chapter" data-level="2.11" data-path="web-页面和-shiny-应用.html"><a href="web-页面和-shiny-应用.html"><i class="fa fa-check"></i><b>2.11</b> Web 页面和 Shiny 应用</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="output-formats.html"><a href="output-formats.html"><i class="fa fa-check"></i><b>3</b> 输出格式</a>
<ul>
<li class="chapter" data-level="3.1" data-path="html.html"><a href="html.html"><i class="fa fa-check"></i><b>3.1</b> HTML</a>
<ul>
<li class="chapter" data-level="3.1.1" data-path="html.html"><a href="html.html#gitbook-style"><i class="fa fa-check"></i><b>3.1.1</b> GitBook 样式</a></li>
<li class="chapter" data-level="3.1.2" data-path="html.html"><a href="html.html#bs4-book"><i class="fa fa-check"></i><b>3.1.2</b> 三列 Bootstrap 样式</a></li>
<li class="chapter" data-level="3.1.3" data-path="html.html"><a href="html.html#bootstrap-style"><i class="fa fa-check"></i><b>3.1.3</b> 默认的 Bootstrap 样式</a></li>
<li class="chapter" data-level="3.1.4" data-path="html.html"><a href="html.html#tufte-style"><i class="fa fa-check"></i><b>3.1.4</b> Tufte 样式</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="latexpdf.html"><a href="latexpdf.html"><i class="fa fa-check"></i><b>3.2</b> LaTeX/PDF</a></li>
<li class="chapter" data-level="3.3" data-path="电子书.html"><a href="电子书.html"><i class="fa fa-check"></i><b>3.3</b> 电子书</a>
<ul>
<li class="chapter" data-level="3.3.1" data-path="电子书.html"><a href="电子书.html#epub"><i class="fa fa-check"></i><b>3.3.1</b> EPUB</a></li>
<li class="chapter" data-level="3.3.2" data-path="电子书.html"><a href="电子书.html#mobi"><i class="fa fa-check"></i><b>3.3.2</b> MOBI</a></li>
</ul></li>
<li class="chapter" data-level="3.4" data-path="a-single-document.html"><a href="a-single-document.html"><i class="fa fa-check"></i><b>3.4</b> 单个文档</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="customization.html"><a href="customization.html"><i class="fa fa-check"></i><b>4</b> 定制化</a>
<ul>
<li class="chapter" data-level="4.1" data-path="yaml-options.html"><a href="yaml-options.html"><i class="fa fa-check"></i><b>4.1</b> YAML 选项</a></li>
<li class="chapter" data-level="4.2" data-path="更换主题.html"><a href="更换主题.html"><i class="fa fa-check"></i><b>4.2</b> 更换主题</a></li>
<li class="chapter" data-level="4.3" data-path="模板.html"><a href="模板.html"><i class="fa fa-check"></i><b>4.3</b> 模板</a></li>
<li class="chapter" data-level="4.4" data-path="configuration.html"><a href="configuration.html"><i class="fa fa-check"></i><b>4.4</b> 配置</a></li>
<li class="chapter" data-level="4.5" data-path="internationalization.html"><a href="internationalization.html"><i class="fa fa-check"></i><b>4.5</b> 国际化</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="editing.html"><a href="editing.html"><i class="fa fa-check"></i><b>5</b> 编辑</a>
<ul>
<li class="chapter" data-level="5.1" data-path="build-the-book.html"><a href="build-the-book.html"><i class="fa fa-check"></i><b>5.1</b> 构建书籍</a></li>
<li class="chapter" data-level="5.2" data-path="预览单个章节.html"><a href="预览单个章节.html"><i class="fa fa-check"></i><b>5.2</b> 预览单个章节</a></li>
<li class="chapter" data-level="5.3" data-path="使用-http-服务预览书籍.html"><a href="使用-http-服务预览书籍.html"><i class="fa fa-check"></i><b>5.3</b> 使用 HTTP 服务预览书籍</a></li>
<li class="chapter" data-level="5.4" data-path="rstudio-ide.html"><a href="rstudio-ide.html"><i class="fa fa-check"></i><b>5.4</b> RStudio IDE</a></li>
<li class="chapter" data-level="5.5" data-path="collaboration.html"><a href="collaboration.html"><i class="fa fa-check"></i><b>5.5</b> 协同工作</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="publishing.html"><a href="publishing.html"><i class="fa fa-check"></i><b>6</b> 发布与出版</a>
<ul>
<li class="chapter" data-level="6.1" data-path="rstudio-connect.html"><a href="rstudio-connect.html"><i class="fa fa-check"></i><b>6.1</b> RStudio Connect</a></li>
<li class="chapter" data-level="6.2" data-path="netlify-drop.html"><a href="netlify-drop.html"><i class="fa fa-check"></i><b>6.2</b> Netlify Drop</a>
<ul>
<li class="chapter" data-level="6.2.1" data-path="netlify-drop.html"><a href="netlify-drop.html#构建和部署的工作流水线"><i class="fa fa-check"></i><b>6.2.1</b> 构建和部署的工作流水线</a></li>
<li class="chapter" data-level="6.2.2" data-path="netlify-drop.html"><a href="netlify-drop.html#开始之前"><i class="fa fa-check"></i><b>6.2.2</b> 开始之前</a></li>
<li class="chapter" data-level="6.2.3" data-path="netlify-drop.html"><a href="netlify-drop.html#构建书籍"><i class="fa fa-check"></i><b>6.2.3</b> 构建书籍</a></li>
<li class="chapter" data-level="6.2.4" data-path="netlify-drop.html"><a href="netlify-drop.html#部署网站"><i class="fa fa-check"></i><b>6.2.4</b> 部署网站</a></li>
<li class="chapter" data-level="6.2.5" data-path="netlify-drop.html"><a href="netlify-drop.html#可选更新站点"><i class="fa fa-check"></i><b>6.2.5</b> <em>可选：更新站点</em></a></li>
<li class="chapter" data-level="6.2.6" data-path="netlify-drop.html"><a href="netlify-drop.html#netlify-subdomain"><i class="fa fa-check"></i><b>6.2.6</b> <em>可选：更改默认子域名</em></a></li>
<li class="chapter" data-level="6.2.7" data-path="netlify-drop.html"><a href="netlify-drop.html#缺点和备选方案"><i class="fa fa-check"></i><b>6.2.7</b> 缺点和备选方案</a></li>
</ul></li>
<li class="chapter" data-level="6.3" data-path="github.html"><a href="github.html"><i class="fa fa-check"></i><b>6.3</b> GitHub</a></li>
<li class="chapter" data-level="6.4" data-path="html-发布功能.html"><a href="html-发布功能.html"><i class="fa fa-check"></i><b>6.4</b> HTML 发布功能</a>
<ul>
<li class="chapter" data-level="6.4.1" data-path="html-发布功能.html"><a href="html-发布功能.html#html-404"><i class="fa fa-check"></i><b>6.4.1</b> HTML 404 页面</a></li>
<li class="chapter" data-level="6.4.2" data-path="html-发布功能.html"><a href="html-发布功能.html#metadata-for-sharing"><i class="fa fa-check"></i><b>6.4.2</b> 用于共享的元数据</a></li>
</ul></li>
<li class="chapter" data-level="6.5" data-path="出版商.html"><a href="出版商.html"><i class="fa fa-check"></i><b>6.5</b> 出版商</a></li>
</ul></li>
<li class="appendix"><span><b>附录</b></span></li>
<li class="chapter" data-level="A" data-path="software-tools.html"><a href="software-tools.html"><i class="fa fa-check"></i><b>A</b> 软件工具</a>
<ul>
<li class="chapter" data-level="A.1" data-path="r-和-r-软件包.html"><a href="r-和-r-软件包.html"><i class="fa fa-check"></i><b>A.1</b> R 和 R 软件包</a></li>
<li class="chapter" data-level="A.2" data-path="pandoc.html"><a href="pandoc.html"><i class="fa fa-check"></i><b>A.2</b> Pandoc</a></li>
<li class="chapter" data-level="A.3" data-path="latex.html"><a href="latex.html"><i class="fa fa-check"></i><b>A.3</b> LaTeX</a></li>
</ul></li>
<li class="chapter" data-level="B" data-path="software-usage.html"><a href="software-usage.html"><i class="fa fa-check"></i><b>B</b> 软件使用</a>
<ul>
<li class="chapter" data-level="B.1" data-path="knitr.html"><a href="knitr.html"><i class="fa fa-check"></i><b>B.1</b> knitr</a></li>
<li class="chapter" data-level="B.2" data-path="r-markdown.html"><a href="r-markdown.html"><i class="fa fa-check"></i><b>B.2</b> R Markdown</a></li>
</ul></li>
<li class="chapter" data-level="C" data-path="常见问题.html"><a href="常见问题.html"><i class="fa fa-check"></i><b>C</b> 常见问题</a></li>
<li class="chapter" data-level="" data-path="参考文献.html"><a href="参考文献.html"><i class="fa fa-check"></i>参考文献</a></li>
<li class="divider"></li>
<li><a href="https://bookdown.org" target="_blank">本书由 bookdown 强力驱动</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Bookdown: 使用 R Markdown 创作书籍和技术文档</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="出版商" class="section level2 hasAnchor" number="6.5">
<h2><span class="header-section-number">6.5</span> 出版商<a href="出版商.html#出版商" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>除了在网上发布你的书之外，你还可以考虑通过出版商出版你的书籍。例如，本书是由 Chapman &amp; Hall/CRC 出版的，在 <a href="https://bookdown.org/yihui/bookdown/" class="uri">https://bookdown.org/yihui/bookdown/</a> 也有免费的在线版本（与出版商达成了协议）。如果你不想与的发布者合作，你还可以考虑自主出版 (<a href="https://en.wikipedia.org/wiki/Self-publishing" class="uri">https://en.wikipedia.org/wiki/Self-publishing</a>)。Pablo Casas 写了两篇你可能会觉得有用的博客文章：<a href="https://blog.datascienceheroes.com/how-to-self-publish-a-book/">“How to self-publish a book”</a> 和 <a href="https://blog.datascienceheroes.com/how-to-self-publish-a-book-customizing-bookdown/">“How to self-publish a book: customizing bookdown”</a>。</p>
<p>如果你选择的出版商支持 LaTeX，那么出版用 <strong>bookdown</strong> 编写的书会容易得多。例如，Chapman &amp; Hall 提供了一个名为 <code>krantz.cls</code> 的 LaTeX 类，Springer 提供的是 <code>svmono.cls</code>。如果要将这些 LaTeX 类应用于 PDF 书籍，请将 <code>index.Rmd</code> 的 YAML 元数据中的 <code>documentclass</code> 设置为 LaTeX 类文件名（不带扩展名 <code>.cls</code>）。</p>
<p>LaTeX 类是 YAML 元数据中最重要的设置。它控制了 PDF 书籍的整体样式。还有一些其他设置是你经常需要调整的，下面我们将展示有关本书的一些详细信息。</p>
<p>本书的 YAML 元数据包含以下设置：</p>
<div class="sourceCode" id="cb138"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb138-1"><a href="出版商.html#cb138-1" tabindex="-1"></a><span class="fu">documentclass</span><span class="kw">:</span><span class="at"> krantz</span></span>
<span id="cb138-2"><a href="出版商.html#cb138-2" tabindex="-1"></a><span class="fu">lot</span><span class="kw">:</span><span class="at"> </span><span class="ch">yes</span></span>
<span id="cb138-3"><a href="出版商.html#cb138-3" tabindex="-1"></a><span class="fu">lof</span><span class="kw">:</span><span class="at"> </span><span class="ch">yes</span></span>
<span id="cb138-4"><a href="出版商.html#cb138-4" tabindex="-1"></a><span class="fu">fontsize</span><span class="kw">:</span><span class="at"> 12pt</span></span>
<span id="cb138-5"><a href="出版商.html#cb138-5" tabindex="-1"></a><span class="fu">monofont</span><span class="kw">:</span><span class="at"> </span><span class="st">&quot;Source Code Pro&quot;</span></span>
<span id="cb138-6"><a href="出版商.html#cb138-6" tabindex="-1"></a><span class="fu">monofontoptions</span><span class="kw">:</span><span class="at"> </span><span class="st">&quot;Scale=0.7&quot;</span></span></code></pre></div>
<p>字段 <code>lot:yes</code> 表示我们需要表格列表；类似地，<code>lof</code> 表示图片列表。基础字体大小是 ‘12pt’，我们使用了 <a href="https://www.fontsquirrel.com/fonts/source-code-pro">Source Code Pro</a> 作为等宽（固定宽度）字体，它适用于本书中的所有程序代码。</p>
<p>在 LaTeX 导言 (preamble)（第 <a href="yaml-options.html#yaml-options">4.1</a> 节）中，我们还有一些设置。首先，我们将主字体族设置为 <a href="https://www.fontsquirrel.com/fonts/alegreya">Alegreya</a>，并且由于此字体没有 <span style="font-variant:small caps;">Small Capitals</span>（小型大写字母）特征，我们使用 Alegreya SC 字体。</p>
<div class="sourceCode" id="cb139"><pre class="sourceCode latex"><code class="sourceCode latex"><span id="cb139-1"><a href="出版商.html#cb139-1" tabindex="-1"></a><span class="fu">\setmainfont</span>[</span>
<span id="cb139-2"><a href="出版商.html#cb139-2" tabindex="-1"></a>  UprightFeatures={SmallCapsFont=AlegreyaSC-Regular}</span>
<span id="cb139-3"><a href="出版商.html#cb139-3" tabindex="-1"></a>]{Alegreya}</span></code></pre></div>
<p>下面的命令通过允许浮动环境占用更大部分的页面而不是浮动，从而使得它们更不太可能浮动。</p>
<div class="sourceCode" id="cb140"><pre class="sourceCode latex"><code class="sourceCode latex"><span id="cb140-1"><a href="出版商.html#cb140-1" tabindex="-1"></a><span class="fu">\renewcommand</span>{<span class="ex">\textfraction</span>}{0.05}</span>
<span id="cb140-2"><a href="出版商.html#cb140-2" tabindex="-1"></a><span class="fu">\renewcommand</span>{<span class="ex">\topfraction</span>}{0.8}</span>
<span id="cb140-3"><a href="出版商.html#cb140-3" tabindex="-1"></a><span class="fu">\renewcommand</span>{<span class="ex">\bottomfraction</span>}{0.8}</span>
<span id="cb140-4"><a href="出版商.html#cb140-4" tabindex="-1"></a><span class="fu">\renewcommand</span>{<span class="ex">\floatpagefraction</span>}{0.75}</span></code></pre></div>
<p>由于 <code>krantz.cls</code> 为引用文段提供了一个环境 <code>VF</code>，因此我们将标准的 <code>quote</code> 环境重新定义为 <code>VF</code>。您可以在第 <a href="markdown-syntax.html#markdown-syntax">2.1</a> 节中看到它的样式。</p>
<div class="sourceCode" id="cb141"><pre class="sourceCode latex"><code class="sourceCode latex"><span id="cb141-1"><a href="出版商.html#cb141-1" tabindex="-1"></a><span class="fu">\renewenvironment</span>{quote}{<span class="kw">\begin</span>{<span class="ex">VF</span>}}{<span class="kw">\end</span>{<span class="ex">VF</span>}}</span></code></pre></div>
<p>然后我们将超链接重新定义为脚注，因为当书印刷在纸上时，读者无法点击文本中的链接，而脚注会告诉他们实际的链接是什么。</p>
<div class="sourceCode" id="cb142"><pre class="sourceCode latex"><code class="sourceCode latex"><span id="cb142-1"><a href="出版商.html#cb142-1" tabindex="-1"></a><span class="fu">\let\oldhref\href</span></span>
<span id="cb142-2"><a href="出版商.html#cb142-2" tabindex="-1"></a><span class="fu">\renewcommand</span>{<span class="ex">\href</span>}[2]{#2<span class="fu">\footnote</span>{<span class="fu">\url</span>{#1}}}</span></code></pre></div>
<p>我们还为 <code>_output.yml</code> 中的 <code>bookdown::pdf_book</code> 格式进行了一些设置：</p>
<div class="sourceCode" id="cb143"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb143-1"><a href="出版商.html#cb143-1" tabindex="-1"></a><span class="at">bookdown:</span><span class="fu">:pdf_book</span><span class="kw">:</span></span>
<span id="cb143-2"><a href="出版商.html#cb143-2" tabindex="-1"></a><span class="at">  </span><span class="fu">includes</span><span class="kw">:</span></span>
<span id="cb143-3"><a href="出版商.html#cb143-3" tabindex="-1"></a><span class="at">    </span><span class="fu">in_header</span><span class="kw">:</span><span class="at"> latex/preamble.tex</span></span>
<span id="cb143-4"><a href="出版商.html#cb143-4" tabindex="-1"></a><span class="at">    </span><span class="fu">before_body</span><span class="kw">:</span><span class="at"> latex/before_body.tex</span></span>
<span id="cb143-5"><a href="出版商.html#cb143-5" tabindex="-1"></a><span class="at">    </span><span class="fu">after_body</span><span class="kw">:</span><span class="at"> latex/after_body.tex</span></span>
<span id="cb143-6"><a href="出版商.html#cb143-6" tabindex="-1"></a><span class="at">  </span><span class="fu">keep_tex</span><span class="kw">:</span><span class="at"> </span><span class="ch">yes</span></span>
<span id="cb143-7"><a href="出版商.html#cb143-7" tabindex="-1"></a><span class="at">  </span><span class="fu">dev</span><span class="kw">:</span><span class="at"> </span><span class="st">&quot;cairo_pdf&quot;</span></span>
<span id="cb143-8"><a href="出版商.html#cb143-8" tabindex="-1"></a><span class="at">  </span><span class="fu">latex_engine</span><span class="kw">:</span><span class="at"> xelatex</span></span>
<span id="cb143-9"><a href="出版商.html#cb143-9" tabindex="-1"></a><span class="at">  </span><span class="fu">citation_package</span><span class="kw">:</span><span class="at"> natbib</span></span>
<span id="cb143-10"><a href="出版商.html#cb143-10" tabindex="-1"></a><span class="at">  </span><span class="fu">template</span><span class="kw">:</span><span class="at"> </span><span class="ch">null</span></span>
<span id="cb143-11"><a href="出版商.html#cb143-11" tabindex="-1"></a><span class="at">  </span><span class="fu">pandoc_args</span><span class="kw">:</span><span class="at"> --top-level-division=chapter</span></span>
<span id="cb143-12"><a href="出版商.html#cb143-12" tabindex="-1"></a><span class="at">  </span><span class="fu">toc_unnumbered</span><span class="kw">:</span><span class="at"> </span><span class="ch">no</span></span>
<span id="cb143-13"><a href="出版商.html#cb143-13" tabindex="-1"></a><span class="at">  </span><span class="fu">toc_appendix</span><span class="kw">:</span><span class="at"> </span><span class="ch">yes</span></span>
<span id="cb143-14"><a href="出版商.html#cb143-14" tabindex="-1"></a><span class="at">  </span><span class="fu">quote_footer</span><span class="kw">:</span><span class="at"> </span><span class="kw">[</span><span class="st">&quot;</span><span class="sc">\\</span><span class="st">VA{&quot;</span><span class="kw">,</span><span class="at"> </span><span class="st">&quot;}{}&quot;</span><span class="kw">]</span></span>
<span id="cb143-15"><a href="出版商.html#cb143-15" tabindex="-1"></a><span class="at">  </span><span class="fu">highlight_bw</span><span class="kw">:</span><span class="at"> </span><span class="ch">yes</span></span></code></pre></div>
<p>我们上面提到的所有导言 (preamble) 设置都在文件 <code>latex/preamble.tex</code> 中，其中我们还指定了前言 (front matter) 的开始：</p>
<blockquote>
<p>译者注：<code>\frontmatter</code> 通常跟在 <code>\begin{document}</code> 后，会关闭章节序号，页码使用罗马数字。</p>
</blockquote>
<div class="sourceCode" id="cb144"><pre class="sourceCode latex"><code class="sourceCode latex"><span id="cb144-1"><a href="出版商.html#cb144-1" tabindex="-1"></a><span class="fu">\frontmatter</span></span></code></pre></div>
<p>在 <code>latex/before_body.tex</code> 中，我们插入了出版商要求的一些空白页，并编写了奉献页。在书的第一章之前，我们插入</p>
<div class="sourceCode" id="cb145"><pre class="sourceCode latex"><code class="sourceCode latex"><span id="cb145-1"><a href="出版商.html#cb145-1" tabindex="-1"></a><span class="fu">\mainmatter</span></span></code></pre></div>
<p>因此，LaTeX 知道将页码样式从罗马数字（前言所用的样式）更改为阿拉伯数字（正文所用的样式）。</p>
<p>我们在 <code>latex/after_body.tex</code>（第 <a href="latex-index.html#latex-index">2.9</a> 节）中打印索引。</p>
<p>由于默认设备 <code>pdf</code> 不能嵌入字体，因此用于保存图片的图形设备 (<code>dev</code>) 被设置为 <code>cairo_pdf</code>，以便字体可以嵌入图片中。你的文案编辑可能会要求您嵌入 PDF 中使用的所有字体，以便该书可以完全按其电子版本的外观打印，否则某些字体可能会被替换，印刷时的字型可能无法预测。</p>
<p><code>quote_footer</code> 字段是为了确保引用页脚右对齐：<code>krantz.cls</code> 提供了 LaTeX 命令 <code>\VA{}</code> 以包含引用页脚。</p>
<p><code>highlight_bw</code> 选项被设置为 true，这样语法高亮显示的代码块中的颜色将转换为灰度，因为这本书将采用黑白打印。</p>
<p>这本书是通过 <code>xelatex</code> 编译成 PDF 的，以便于我们使用自定义字体。</p>
<p>除 <code>VF</code> 环境和 <code>\VA{}</code> 命令外，上述所有设置都可以应用于任何其他 LaTeX 文档类。</p>
<p>如果你也想与 Chapman &amp; Hall 合作，你可以从我们存储库 (<a href="https://github.com/rstudio/bookdown/tree/master/inst/examples" class="uri">https://github.com/rstudio/bookdown/tree/master/inst/examples</a>) 中的 <code>krantz.cls</code> 文件开始，而不使用你从编辑那里得到的副本。我们已经与 LaTeX 帮助中心合作解决了这个 LaTeX 类的许多问题，所以如果你使用 <strong>bookdown</strong>，希望它能很好地用于你的书。</p>

</div>
<!-- </div> -->



            </section>

          </div>
        </div>
      </div>
<a href="html-发布功能.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="software-tools.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
    </div>
  </div>
<script src="libs/gitbook/js/app.min.js"></script>
<script src="libs/gitbook/js/clipboard.min.js"></script>
<script src="libs/gitbook/js/plugin-search.js"></script>
<script src="libs/gitbook/js/plugin-sharing.js"></script>
<script src="libs/gitbook/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook/js/plugin-bookdown.js"></script>
<script src="libs/gitbook/js/jquery.highlight.js"></script>
<script src="libs/gitbook/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": true,
"facebook": false,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"whatsapp": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/YuanchenZhu2020/bookdown-book-zhCN/edit/main/06-publishing.Rmd",
"text": "编辑"
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": ["bookdown-book-zhCN.pdf", "bookdown-book-zhCN.epub", "bookdown-book-zhCN.mobi"],
"search": {
"engine": "fuse",
"options": null
},
"toc": {
"collapse": "none"
}
});
});
</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    var src = "true";
    if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-MML-AM_CHTML";
    if (location.protocol !== "file:")
      if (/^https?:/.test(src))
        src = src.replace(/^https?:/, '');
    script.src = src;
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>
</body>

</html>
